import java.awt.Dimension;

import javax.swing.JTextField;


public class ThinTextField extends JTextField {
	protected boolean withCols;
	
	public ThinTextField() {
		super();
		withCols = false;
	}
	
	public ThinTextField(int cols) {
		super(cols);
		withCols = true;
	}
	
	@Override
	public Dimension getMaximumSize() {
		if (withCols)
			return getPreferredSize();
		else {
			Dimension dim = super.getMaximumSize();
	        dim.height = getPreferredSize().height;
	        return dim;
		}
	}

}
